home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / catD / buf.z / buf
Encoding:
Text File  |  2002-10-03  |  21.3 KB  |  265 lines

  1.  
  2.  
  3.  
  4. bbbbuuuuffff((((DDDD4444))))                                                                bbbbuuuuffff((((DDDD4444))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _bbbb_uuuu_ffff - block I/O data transfer structure
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
  13.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_pppp_rrrr_oooo_cccc_...._hhhh_>>>>
  14.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_bbbb_uuuu_ffff_...._hhhh_>>>>
  15.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_dddd_dddd_iiii_...._hhhh_>>>>
  16.  
  17.  
  18. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  19.      The _bbbb_uuuu_ffff structure is the basic data structure for block I/O transfers.
  20.  
  21. UUUUSSSSAAAAGGGGEEEE
  22.      Each block I/O transfer has an associated buffer header.  The header
  23.      contains all the buffer control and status information.  For drivers, the
  24.      buffer header pointer is the sole argument to a block driver _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy(D2)
  25.      routine.  Do not depend on the size of the _bbbb_uuuu_ffff structure when writing a
  26.      driver.
  27.  
  28.      It is important to note that a buffer header may be linked in multiple
  29.      lists simultaneously.  Because of this, most of the members in the buffer
  30.      header cannot be changed by the driver, even when the buffer header is in
  31.      one of the drivers' work lists.
  32.  
  33.      Buffer headers may be used by the system to describe a portion of the
  34.      kernel data space for I/O for block drivers.  Buffer headers are also
  35.      used by the system for physical I/O for block drivers.  In this case, the
  36.      buffer describes a portion of user data space that is locked into memory
  37.      (see _pppp_hhhh_yyyy_ssss_iiii_oooo_cccc_kkkk(D3)).
  38.  
  39.      Block drivers often chain block requests so that overall throughput for
  40.      the device is maximized.  The _aaaa_vvvv______ffff_oooo_rrrr_wwww and the _aaaa_vvvv______bbbb_aaaa_cccc_kkkk members of the _bbbb_uuuu_ffff
  41.      structure can serve as link pointers for chaining block requests.
  42.  
  43.    SSSSttttrrrruuuuccccttttuuuurrrreeee DDDDeeeeffffiiiinnnniiiittttiiiioooonnnnssss
  44.      The _bbbb_uuuu_ffff structure contains the following members:
  45.  
  46.      _uuuu_iiii_nnnn_tttt_6666_4444______tttt        _bbbb______ffff_llll_aaaa_gggg_ssss_;;;;        _////_**** _BBBB_uuuu_ffff_ffff_eeee_rrrr _ssss_tttt_aaaa_tttt_uuuu_ssss _****_////
  47.      _ssss_tttt_rrrr_uuuu_cccc_tttt _bbbb_uuuu_ffff      _****_bbbb______ffff_oooo_rrrr_wwww_;;;;        _////_**** _KKKK_eeee_rrrr_nnnn_eeee_llll_////_dddd_rrrr_iiii_vvvv_eeee_rrrr _llll_iiii_ssss_tttt _llll_iiii_nnnn_kkkk _****_////
  48.      _ssss_tttt_rrrr_uuuu_cccc_tttt _bbbb_uuuu_ffff      _****_bbbb______bbbb_aaaa_cccc_kkkk_;;;;        _////_**** _KKKK_eeee_rrrr_nnnn_eeee_llll_////_dddd_rrrr_iiii_vvvv_eeee_rrrr _llll_iiii_ssss_tttt _llll_iiii_nnnn_kkkk _****_////
  49.      _ssss_tttt_rrrr_uuuu_cccc_tttt _bbbb_uuuu_ffff      _****_aaaa_vvvv______ffff_oooo_rrrr_wwww_;;;;       _////_**** _DDDD_rrrr_iiii_vvvv_eeee_rrrr _wwww_oooo_rrrr_kkkk _llll_iiii_ssss_tttt _llll_iiii_nnnn_kkkk _****_////
  50.      _ssss_tttt_rrrr_uuuu_cccc_tttt _bbbb_uuuu_ffff      _****_aaaa_vvvv______bbbb_aaaa_cccc_kkkk_;;;;       _////_**** _DDDD_rrrr_iiii_vvvv_eeee_rrrr _wwww_oooo_rrrr_kkkk _llll_iiii_ssss_tttt _llll_iiii_nnnn_kkkk _****_////
  51.      _uuuu_nnnn_ssss_iiii_gggg_nnnn_eeee_dddd _iiii_nnnn_tttt    _bbbb______bbbb_cccc_oooo_uuuu_nnnn_tttt_;;;;       _////_**** _#### _oooo_ffff _bbbb_yyyy_tttt_eeee_ssss _tttt_oooo _tttt_rrrr_aaaa_nnnn_ssss_ffff_eeee_rrrr _****_////
  52.      _uuuu_nnnn_iiii_oooo_nnnn _{{{{
  53.             _cccc_aaaa_dddd_dddd_rrrr______tttt  _bbbb______aaaa_dddd_dddd_rrrr_;;;;         _////_**** _BBBB_uuuu_ffff_ffff_eeee_rrrr_''''_ssss _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll _aaaa_dddd_dddd_rrrr_eeee_ssss_ssss _****_////
  54.      _}}}} _bbbb______uuuu_nnnn_;;;;
  55.      _dddd_aaaa_dddd_dddd_rrrr______tttt         _bbbb______bbbb_llll_kkkk_nnnn_oooo_;;;;        _////_**** _BBBB_llll_oooo_cccc_kkkk _nnnn_uuuu_mmmm_bbbb_eeee_rrrr _oooo_nnnn _dddd_eeee_vvvv_iiii_cccc_eeee _****_////
  56.      _uuuu_nnnn_ssss_iiii_gggg_nnnn_eeee_dddd _iiii_nnnn_tttt    _bbbb______rrrr_eeee_ssss_iiii_dddd_;;;;        _////_**** _#### _oooo_ffff _bbbb_yyyy_tttt_eeee_ssss _nnnn_oooo_tttt _tttt_rrrr_aaaa_nnnn_ssss_ffff_eeee_rrrr_rrrr_eeee_dddd _****_////
  57.      _cccc_llll_oooo_cccc_kkkk______tttt         _bbbb______ssss_tttt_aaaa_rrrr_tttt_;;;;        _////_**** _RRRR_eeee_qqqq_uuuu_eeee_ssss_tttt _ssss_tttt_aaaa_rrrr_tttt _tttt_iiii_mmmm_eeee _****_////
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. bbbbuuuuffff((((DDDD4444))))                                                                bbbbuuuuffff((((DDDD4444))))
  71.  
  72.  
  73.  
  74.      _ssss_tttt_rrrr_uuuu_cccc_tttt _pppp_rrrr_oooo_cccc     _****_bbbb______pppp_rrrr_oooo_cccc_;;;;        _////_**** _PPPP_rrrr_oooo_cccc_eeee_ssss_ssss _ssss_tttt_rrrr_uuuu_cccc_tttt_uuuu_rrrr_eeee _pppp_oooo_iiii_nnnn_tttt_eeee_rrrr _****_////
  75.      _llll_oooo_nnnn_gggg            _bbbb______bbbb_uuuu_ffff_ssss_iiii_zzzz_eeee_;;;;      _////_**** _SSSS_iiii_zzzz_eeee _oooo_ffff _aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_dddd _bbbb_uuuu_ffff_ffff_eeee_rrrr _****_////
  76.      _vvvv_oooo_iiii_dddd            _((((_****_bbbb______iiii_oooo_dddd_oooo_nnnn_eeee_))))_((((_))))_;;;;  _////_**** _FFFF_uuuu_nnnn_cccc_tttt_iiii_oooo_nnnn _cccc_aaaa_llll_llll_eeee_dddd _bbbb_yyyy _bbbb_iiii_oooo_dddd_oooo_nnnn_eeee _****_////
  77.      _vvvv_oooo_iiii_dddd            _****_bbbb______iiii_oooo_cccc_hhhh_aaaa_iiii_nnnn_;;;;     _////_**** _llll_iiii_nnnn_kkkk _pppp_oooo_iiii_nnnn_tttt_eeee_rrrr _ffff_oooo_rrrr _iiii_oooo_dddd_oooo_nnnn_eeee _cccc_hhhh_aaaa_iiii_nnnn _****_////
  78.      _dddd_eeee_vvvv______tttt           _bbbb______eeee_dddd_eeee_vvvv_;;;;         _////_**** _EEEE_xxxx_pppp_aaaa_nnnn_dddd_eeee_dddd _dddd_eeee_vvvv _ffff_iiii_eeee_llll_dddd _****_////
  79.      _vvvv_oooo_iiii_dddd            _****_bbbb______pppp_rrrr_iiii_vvvv_aaaa_tttt_eeee_;;;;     _////_**** _FFFF_oooo_rrrr _dddd_rrrr_iiii_vvvv_eeee_rrrr_''''_ssss _uuuu_ssss_eeee _iiii_nnnn _SSSS_VVVV_RRRR_4444_MMMM_PPPP _oooo_nnnn_llll_yyyy_****_////
  80.  
  81.      The members of the buffer header available to test or set by a driver are
  82.      described below:
  83.  
  84.      _bbbb______ffff_llll_aaaa_gggg_ssss is a bitmask that stores the buffer status and tells the driver
  85.      whether to read from or write to the device.  To avoid an error
  86.      condition, the driver must never clear the _bbbb______ffff_llll_aaaa_gggg_ssss member or modify its
  87.      value, except by setting or clearing individual flag bits as described
  88.      below.
  89.  
  90.      Valid flags are as follows:
  91.  
  92.           _BBBB______BBBB_UUUU_SSSS_YYYY      The buffer is in use.  The driver may change this flag
  93.                       only if it acquired the buffer with _gggg_eeee_tttt_rrrr_bbbb_uuuu_ffff(D3), and if
  94.                       no I/O operation is in progress.
  95.  
  96.           _BBBB______DDDD_OOOO_NNNN_EEEE      The data transfer has completed.  The driver should not
  97.                       change this flag.
  98.  
  99.           _BBBB______EEEE_RRRR_RRRR_OOOO_RRRR     The driver sets _BBBB______EEEE_RRRR_RRRR_OOOO_RRRR to indicate an error occurred
  100.                       during an I/O transfer.  On systems where the
  101.                       _bbbb_iiii_oooo_eeee_rrrr_rrrr_oooo_rrrr(D3) function is available, drivers should not
  102.                       access this flag directly.
  103.  
  104.           _BBBB______PPPP_AAAA_GGGG_EEEE_IIII_OOOO    The buffer is being used in a paged I/O request.  If
  105.                       _BBBB______PPPP_AAAA_GGGG_EEEE_IIII_OOOO is set, the _bbbb______pppp_aaaa_gggg_eeee_ssss field of the buffer header
  106.                       points to a list of page structures sorted by block
  107.                       location on the device.  Also, the _bbbb______uuuu_nnnn_...._bbbb______aaaa_dddd_dddd_rrrr field of
  108.                       the buffer header is the offset into the first page of
  109.                       the page list.  If _BBBB______PPPP_AAAA_GGGG_EEEE_IIII_OOOO is not set, the _bbbb______pppp_aaaa_gggg_eeee_ssss
  110.                       field of the buffer header is not used and the
  111.                       _bbbb______uuuu_nnnn_...._bbbb______aaaa_dddd_dddd_rrrr field of the buffer header contains the
  112.                       starting virtual address of the I/O request (in user
  113.                       address space if _BBBB______PPPP_HHHH_YYYY_SSSS is set or kernel address space
  114.                       otherwise).  The driver must not set or clear the
  115.                       _BBBB______PPPP_AAAA_GGGG_EEEE_IIII_OOOO flag.
  116.  
  117.           _BBBB______PPPP_HHHH_YYYY_SSSS      The buffer header is being used for physical (direct)
  118.                       I/O to a user data area.  The _bbbb______uuuu_nnnn_...._bbbb______aaaa_dddd_dddd_rrrr member
  119.                       contains the starting virtual address of the user data
  120.                       area.  Note that _BBBB______PPPP_HHHH_YYYY_SSSS and _BBBB______PPPP_AAAA_GGGG_EEEE_IIII_OOOO are never set
  121.                       simultaneously and must not be changed by the driver.
  122.  
  123.           _BBBB______RRRR_EEEE_AAAA_DDDD      Data are to be read from the peripheral device into main
  124.                       memory.  The driver may change this flag only if it
  125.                       acquired the buffer with _gggg_eeee_tttt_rrrr_bbbb_uuuu_ffff(D3), _gggg_eeee_tttt_eeee_bbbb_llll_kkkk(D3), or
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. bbbbuuuuffff((((DDDD4444))))                                                                bbbbuuuuffff((((DDDD4444))))
  137.  
  138.  
  139.  
  140.                       _nnnn_gggg_eeee_tttt_eeee_bbbb_llll_kkkk(D3), and if no I/O operation is in progress.
  141.  
  142.           _BBBB______WWWW_RRRR_IIII_TTTT_EEEE     Data are to be transferred from main memory to the
  143.                       peripheral device.  _BBBB______WWWW_RRRR_IIII_TTTT_EEEE is a pseudo-flag that
  144.                       occupies the same bit location as _BBBB______RRRR_EEEE_AAAA_DDDD.  _BBBB______WWWW_RRRR_IIII_TTTT_EEEE
  145.                       cannot be directly tested; it is only detected as the
  146.                       absence of _BBBB______RRRR_EEEE_AAAA_DDDD (_!!!!_((((_bbbb_pppp_----_>>>>_bbbb______ffff_llll_aaaa_gggg_ssss_&&&&_BBBB______RRRR_EEEE_AAAA_DDDD_)))).)
  147.  
  148.      _bbbb______ffff_oooo_rrrr_wwww and _bbbb______bbbb_aaaa_cccc_kkkk may only be used by the driver if the buffer was
  149.      acquired by the driver with the _gggg_eeee_tttt_rrrr_bbbb_uuuu_ffff routine.  In that case, these
  150.      members can be used to link the buffer into driver work lists.
  151.  
  152.      _aaaa_vvvv______ffff_oooo_rrrr_wwww and _aaaa_vvvv______bbbb_aaaa_cccc_kkkk can be used by the driver to link the buffer into
  153.      driver work lists.
  154.  
  155.      _bbbb______bbbb_cccc_oooo_uuuu_nnnn_tttt specifies the number of bytes to be transferred for both paged
  156.      and non-paged I/O requests.  The driver may change this member.
  157.  
  158.      _bbbb______uuuu_nnnn_...._bbbb______aaaa_dddd_dddd_rrrr is either the virtual address of the I/O request, or an
  159.      offset into the first page of a page list depending on whether _BBBB______PPPP_AAAA_GGGG_EEEE_IIII_OOOO
  160.      is set.  If it is set, the _bbbb______pppp_aaaa_gggg_eeee_ssss field of the buffer header points to a
  161.      sorted list of page structures and _bbbb______uuuu_nnnn_...._bbbb______aaaa_dddd_dddd_rrrr is the offset into the
  162.      first page.  If _BBBB______PPPP_AAAA_GGGG_EEEE_IIII_OOOO is not set, _bbbb______uuuu_nnnn_...._bbbb______aaaa_dddd_dddd_rrrr is the virtual address
  163.      from which data are read or to which data are written.  It represents a
  164.      user virtual address if _BBBB______PPPP_HHHH_YYYY_SSSS is set, or a kernel virtual address
  165.      otherwise.  The driver may change this member.
  166.  
  167.      _bbbb______bbbb_llll_kkkk_nnnn_oooo identifies which logical block on the device is to be accessed.
  168.      The driver may have to convert this logical block number to a physical
  169.      location such as a cylinder, track, and sector of a disk.  The driver may
  170.      change this member only if it allocated the buffer via _gggg_eeee_tttt_eeee_bbbb_llll_kkkk, _nnnn_gggg_eeee_tttt_eeee_bbbb_llll_kkkk,
  171.      or _gggg_eeee_tttt_rrrr_bbbb_uuuu_ffff, and if no I/O operation is in progress.
  172.  
  173.      _bbbb______rrrr_eeee_ssss_iiii_dddd indicates the number of bytes not transferred.  The driver must
  174.      set this member prior to calling _bbbb_iiii_oooo_dddd_oooo_nnnn_eeee(D3).
  175.  
  176.      _bbbb______ssss_tttt_aaaa_rrrr_tttt holds the time the I/O request was started.  It is provided for
  177.      the driver's use in calculating response time and is set by the driver.
  178.      Its type, _cccc_llll_oooo_cccc_kkkk______tttt, is an integral type upon which direct integer
  179.      calculations can be performed.  It represents clock ticks.
  180.  
  181.      _bbbb______pppp_rrrr_oooo_cccc contains the process structure address for the process requesting
  182.      an unbuffered (direct) data transfer to or from a user data area (this
  183.      member is set to _NNNN_UUUU_LLLL_LLLL when the transfer is buffered).  The process table
  184.      entry is used to perform proper virtual to physical address translation
  185.      of the _bbbb______uuuu_nnnn_...._bbbb______aaaa_dddd_dddd_rrrr member.  The driver should not change this member.
  186.  
  187.      _bbbb______bbbb_uuuu_ffff_ssss_iiii_zzzz_eeee contains the size in bytes of the allocated buffer.  The driver
  188.      may change this member only if it acquired the buffer with _gggg_eeee_tttt_rrrr_bbbb_uuuu_ffff, and
  189.      if no I/O operation is in progress.
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. bbbbuuuuffff((((DDDD4444))))                                                                bbbbuuuuffff((((DDDD4444))))
  203.  
  204.  
  205.  
  206.      _((((_****_bbbb______iiii_oooo_dddd_oooo_nnnn_eeee_)))) identifies a specific driver routine to be called by the
  207.      system when the I/O is complete.  If a routine is specified, the
  208.      _bbbb_iiii_oooo_dddd_oooo_nnnn_eeee(D3) routine does not return the buffer to the system.  The driver
  209.      may change this member if no I/O operation is in progress.
  210.  
  211.      _((((_****_bbbb______iiii_oooo_cccc_hhhh_aaaa_iiii_nnnn_)))) If b_iodone has been set by another driver layer, it is
  212.      important to preserve its value and make sure it is called upon i/o
  213.      completion.  b_iochain is proved for this purpose.  For example, a driver
  214.      that wishes to use b_iodone should save the old value of b_iodone and
  215.      b_iochain and write the address of these saved values into b_iochain and
  216.      its completion routines address into b_iodone.  When the completion
  217.      routine is called, it should restore both b_iodone and b_iochain and call
  218.      biodone() with the buffer again.
  219.  
  220.      _bbbb______eeee_dddd_eeee_vvvv contains the external device number of the device.  The driver may
  221.      change this member only if it allocated the buffer via _gggg_eeee_tttt_eeee_bbbb_llll_kkkk, _nnnn_gggg_eeee_tttt_eeee_bbbb_llll_kkkk,
  222.      or _gggg_eeee_tttt_rrrr_bbbb_uuuu_ffff, and if no I/O operation is in progress.
  223.  
  224.    WWWWaaaarrrrnnnniiiinnnnggggssss
  225.      Buffers are a shared resource within the kernel.  Drivers should only
  226.      read or write the members listed in this section in accordance with the
  227.      rules given above.  Drivers that attempt to use undocumented members of
  228.      the _bbbb_uuuu_ffff structure risk corrupting data in the kernel and on the device.
  229.  
  230.      DDI/DKI-conforming drivers may only use buffer headers that have been
  231.      allocated using _gggg_eeee_tttt_eeee_bbbb_llll_kkkk, _nnnn_gggg_eeee_tttt_eeee_bbbb_llll_kkkk, or _gggg_eeee_tttt_rrrr_bbbb_uuuu_ffff, or have been passed to the
  232.      driver _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy routine.
  233.  
  234. RRRREEEEFFFFEEEERRRREEEENNNNCCCCEEEESSSS
  235.      biodone(D3), bioerror(D3), biowait(D3), brelse(D3), clrbuf(D3),
  236.      freerbuf(D3), geteblk(D3), geterror(D3), getrbuf(D3), iovec(D4),
  237.      ngeteblk(D3), physiock(D3), strategy(D2), uio(D4), uiophysio(D3X).
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.